package com.qiyu.dubbo.router.starter.zone.zk;

import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.extension.SPI;
import org.apache.dubbo.registry.Registry;
import org.apache.dubbo.registry.support.AbstractRegistryFactory;
import org.apache.dubbo.remoting.zookeeper.ZookeeperTransporter;

/**
 * @Author idea
 * @Date created in 3:20 下午 2020/11/26
 */
public class ZoneAwareZookeeperRegisterFactory extends AbstractRegistryFactory {

    private ZookeeperTransporter zookeeperTransporter;

    /**
     *  dubbo的spi自动具有依赖注入的功能
     *
     * @param zookeeperTransporter
     */
    public void setZookeeperTransporter(ZookeeperTransporter zookeeperTransporter) {
        this.zookeeperTransporter = zookeeperTransporter;
    }

    @Override
    public Registry createRegistry(URL url) {
        return new ZoneAwareZookeeperRegister(url,zookeeperTransporter);
    }
}
